package com.blockmeta.bbs.businesslibrary.umeng.circle;

import android.os.Parcel;
import android.os.Parcelable;

import com.blockmeta.bbs.businesslibrary.umeng.TypeDescribe;

/**
 * @author AirThor
 * @date 2020/3/31.
 */
public class ShareContent implements Parcelable {
    public long id;

    public String mTitle;

    public String mDescribe;

    public String mThumb;

    public String mUrl;

    public String mCustomShareJson;

    public TypeDescribe mTypeDescribe;

    public String mBitmap;

    public IShareObject.ShareType mShareType;


    public ShareContent() {
    }

    @Override
    public String toString() {
        return mTitle+mDescribe;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.id);
        dest.writeString(this.mTitle);
        dest.writeString(this.mDescribe);
        dest.writeString(this.mThumb);
        dest.writeString(this.mUrl);
        dest.writeString(this.mCustomShareJson);
        dest.writeInt(this.mTypeDescribe == null ? -1 : this.mTypeDescribe.ordinal());
        dest.writeString(this.mBitmap);
        dest.writeInt(this.mShareType == null ? -1 : this.mShareType.ordinal());
    }

    protected ShareContent(Parcel in) {
        this.id = in.readLong();
        this.mTitle = in.readString();
        this.mDescribe = in.readString();
        this.mThumb = in.readString();
        this.mUrl = in.readString();
        this.mCustomShareJson = in.readString();
        int tmpMTypeDescribe = in.readInt();
        this.mTypeDescribe = tmpMTypeDescribe == -1 ? null : TypeDescribe.values()[tmpMTypeDescribe];
        this.mBitmap = in.readString();
        int tmpMShareType = in.readInt();
        this.mShareType = tmpMShareType == -1 ? null : IShareObject.ShareType.values()[tmpMShareType];
    }

    public static final Creator<ShareContent> CREATOR = new Creator<ShareContent>() {
        @Override
        public ShareContent createFromParcel(Parcel source) {
            return new ShareContent(source);
        }

        @Override
        public ShareContent[] newArray(int size) {
            return new ShareContent[size];
        }
    };
}
